import {
    createStore,
    combineReducers,
    applyMiddleware
} from 'redux'
import reducers from './reducers';
import thunk from 'redux-thunk';
import { DEFAULT_SELECTED_KEYS, DEFAULT_OPEN_KEYS } from '../Common/common';
import { getSessionItem } from 'utils/sessionStorage';
export default createStore(
    combineReducers(reducers),
    {
        step: '1',
        phone: '',
        historyStep: '1',
        defaultOpenKeys: JSON.parse(getSessionItem(DEFAULT_OPEN_KEYS)) && JSON.parse(getSessionItem(DEFAULT_OPEN_KEYS)).length > 0 ? JSON.parse(getSessionItem(DEFAULT_OPEN_KEYS)) : [],
        defaultSelectedKeys: getSessionItem(DEFAULT_SELECTED_KEYS) || "['1']"
    },
    applyMiddleware(thunk)
)